/*
 * HODJ1006.cpp
 *
 *  Created on: 2016年7月30日
 *      Author: none
 */

#include<iostream>
#include<cmath>
#include<cstdio>

using namespace std;

const int H = 24;
const int M = 60;
const int S = 60;
const double hour_w=360.0/((H/2)*S*M);
const double min_w=360.0/(S*M);
const double sec_w=360.0/S;
const int sum_sec=(H/2)*M*S;

int main(void)
{
	int d,sum;
	double hour_p,sec_p,min_p,diff_h_s,diff_h_m,diff_m_s;
	cin>>d;
	while(d!=-1)
	{
		hour_p=sec_p=min_p=0;
		sum=0;
		for(int i=1;i<=sum_sec;i++)
		{
			hour_p=hour_p+hour_w;
			sec_p=sec_p+sec_w;
			min_p=min_p+min_w;
			if(((int)hour_p)>=360) hour_p=hour_p-360.0;
			if(((int)sec_p)>=360) sec_p=sec_p-360.0;
			if(((int)min_p)>=360) min_p=min_p-360.0;

			diff_h_s=hour_p-sec_p;
			diff_h_m=hour_p-min_p;
			diff_m_s=min_p-sec_p;
			if(diff_h_s<0) diff_h_s=diff_h_s*(-1);
			if(diff_h_m<0) diff_h_m=diff_h_m*(-1);
			if(diff_m_s<0) diff_m_s=diff_m_s*(-1);
			if(diff_h_m>=d && diff_h_s>=d && diff_m_s>=d
					&& diff_h_m<=360-d && diff_h_s<=360-d && diff_m_s<=360-d)
				sum++;
		}
		printf("%.3f\n",(sum*1.0)/(sum_sec)*100);
		cin>>d;
	}
}


